home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / flilib.zip / FLISRC.ZIP / DIRLIST.C < prev    next >
C/C++ Source or Header  |  1989-11-16  |  881b  |  39 lines

  1.  
  2. #include "aatypes.h"
  3. #include "aai86.h"
  4. #include "aados.h"
  5.  
  6. /* get the 'data transfer area' ms-dos will use doing directory searches */
  7. Fndata *dos_get_dta()
  8. {
  9. union i86_regs reg;
  10.  
  11. /* get the 'DTA' area for directory search */
  12. reg.b.ah = 0x2f;
  13. i86_sysint(0x21,®,®);
  14. return(i86_make_ptr(reg.w.bx, reg.w.es));
  15. }
  16.  
  17. /* find the first file that matches the pattern with the right attributes */
  18. Boolean dos_first(char *pat, int attr)
  19. {
  20. union i86_regs reg;
  21.  
  22. /* now do the find first... */
  23. reg.b.ah = 0x4e;    /* int 21 function # */
  24. reg.w.cx = attr;    /* 'attribute' */
  25. reg.w.dx = i86_ptr_offset(pat);
  26. reg.w.ds = i86_ptr_seg(pat);
  27. return(!(i86_sysint(0x21,®,®)&1)); /* check carry flag for error... */
  28. }
  29.  
  30. /* find the next matching file */
  31. Boolean dos_next ()
  32. {
  33. union i86_regs reg;
  34.  
  35. reg.b.ah = 0x4f;
  36. return(!(i86_sysint(0x21,®,®)&1));
  37. }
  38.  
  39.